<?php

namespace app\admin\controller;

use think\Controller;
use think\Error;

class Base extends Controller
{
    public function initialize()
    {
        parent::initialize();
    }

    public function validateData($validate_model,$scene,$data=[]){
        if(!$validate_model || !$scene) return false;
        if(!$data) $data =request()->param();
        $validate_name = "app\\common\\validate\\" . ucfirst($validate_model);
        $validate = new $validate_name;
        $validateResult = $validate->scene($scene)->check($data);
        return $validateResult ?: $validate->getError();
    }
}
